#ifndef LOGIN_H
#define LOGIN_H

#include <QDialog>
#include "XMysqlConnect.h"
#include "qjsonobject.h"
#include "qlabel.h"
namespace Ui {
class Login;
}

class Login : public QDialog
{
    Q_OBJECT

public:
    explicit Login(QWidget *parent = nullptr);
    ~Login();
    void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
private slots:
    void on_minBut_clicked();

    void on_closeBut_clicked();

    void on_loginBut_clicked();

    void on_lineEdit_user_textChanged(const QString &arg1);

    void on_lineEdit_password_textChanged(const QString &arg1);

signals:
    void loginSignal(QString,std::shared_ptr<XMysqlConnect>);
private:
    void saveInfo(QString &name,QString &password);
    void showCW(QLabel*,QString&&);
    void showCWUser(QString &&s);
    void showCWPassword(QString &&s);
    //void save
private:
    QPoint windowPos{};
    QPoint mousePos{};
    QPoint dPos{};
    Ui::Login *ui=nullptr;
    bool optFor=false;
    std::shared_ptr<XMysqlConnect> Sql=std::make_shared<XMysqlConnect>();
    bool isok=false;
    bool userIsOk=true;
    bool passIsOk=true;
    QJsonObject obj;
};

#endif // LOGIN_H
